1. Field of the Invention
This invention is related to the field of processors and, more particularly, to the handling of flags during processing of system call instructions.
2. Description of the Related Art
Many instruction set architectures include some form of system call and system return instructions to provide a convenient mechanism for application programs to call operating system routines (e.g. to perform operating system services on behalf of the application programs). For example, Advanced Micro Devices, Inc. defined the SYSCALL and SYSRET instruction extensions to the x86 architecture (also referred to as the IA-32 architecture). These instructions will be referred to herein as Syscall and Sysret, respectively.
The Syscall instruction may be used by an application program to make a system call, and the Sysret may be used in the called operating system routine to return to the calling application program. In addition to other operations setting up for and causing a branch to the operating system routine, the Syscall instruction is defined to perform a predetermined update to the flags (stored in the EFLAGS register). Specifically, the interrupt flag (IF), the virtual 8086 mode (VM) flag, and the resume flag (RF) are cleared. The state of the other flags is not changed.
Computer systems including processors which implement the Syscall and Sysret instructions may include a variety of different operating systems. For example, such computer systems may use the Windows line of operating systems developed by Microsoft Corporation. Alternatively, such computer systems may include the Linux operating system (or other variations of the Unix operating system). Other operating systems may also be used.
The various operating systems may be designed to operate with different states of the flags. In some cases, the flag states desired by the operating systems may conflict with each other. Each operating system generally includes code at the target(s) of the Syscall instruction to modify the flags to the desired state, to the extent that the desired states differ from those created by the Syscall instruction. Such code may increase the latency experienced when the Syscall instruction is used to perform an operating system call.
In a prior art processor, certain microcode instructions (e.g. a logical AND instruction or a logical OR instruction) were used to update the flags register by logically ANDing or logically ORing the contents of the flags register with the contents of another register.